package com.ulife.category.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ulife.category.dao.PropertyDao;
import com.ulife.category.dao.dataobject.PropertyDo;

public class PropertyDaoImpl extends SqlMapClientDaoSupport implements PropertyDao {

	public Long insertProperty(PropertyDo prDo) throws SQLException {
		return (Long)getSqlMapClientTemplate().insert("Property.insertProperty", prDo);
	}

	public int updateProperty(PropertyDo prDo) throws SQLException {
		return getSqlMapClient().update("Property.updateProperty",prDo);
	}

	public PropertyDo queryPropertyByPId(Long pId) throws SQLException {
		return (PropertyDo) getSqlMapClient().queryForObject("Property.queryPropertyByPId", pId);
	}

	@SuppressWarnings("unchecked")
	public List<PropertyDo> queryPropertysByCId(Long cId) throws SQLException {
		return getSqlMapClient().queryForList("Property.queryPropertysByCId", cId);
	}

	@SuppressWarnings("unchecked")
	public List<PropertyDo> queryPropertyByCode(String pCode) throws SQLException {
		return getSqlMapClient().queryForList("Property.queryPropertyByCode", pCode);
	}
	
	public int deleteProperty(PropertyDo prDo) throws SQLException {
		return getSqlMapClientTemplate().delete("Property.deleteProperty",prDo);
	}

}
